home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / OGRID110 / PRINTDOC.PAS < prev    next >
Pascal/Delphi Source File  |  1995-06-01  |  1KB  |  58 lines

  1. program PrintDoc;
  2.  
  3. Uses Crt, Printer;
  4.  
  5. const
  6.    DocFileName = 'MANUAL.TXT';
  7.  
  8. var
  9.   DocFile : Text;
  10.   Counter : Byte;
  11.   LineRead : String;
  12.   Page : Integer;
  13.   X, Y : Byte;
  14.  
  15. begin
  16.   writeln;
  17.   write('Printing...');
  18.   X := WhereX;
  19.   Y := WhereY;
  20.   Assign(DocFile, DocFileName);
  21.   {$I-}
  22.   Reset(DocFile);
  23.   {$I+}
  24.   if IOResult <> 0 then
  25.   begin
  26.     writeln('operation aborted');
  27.     writeln ('ERROR: the file ', DocFileName, ' was not found.');
  28.     halt(1);
  29.   end; {...if IOResult <> 0 }
  30.   for Counter := 1 to 4 do
  31.     Readln(DocFile, LineRead);
  32.   Page := 1;
  33.   while not Eof(DocFile) do
  34.   begin
  35.     GoToXY(X, Y);
  36.     Write('page ',Page);
  37.     Counter := 1;
  38.     while not Eof(DocFile) and (Counter <= 60) do
  39.     begin
  40.       Readln(DocFile, LineRead);
  41.       Writeln(Lst, LineRead);
  42.       Inc(Counter);
  43.     end; {...while not Eof(DocFile) and (Counter <= 57) }
  44.     Counter := 1;
  45.     while not Eof(DocFile) and (((Page=1) and (Counter <= 6)) or
  46.        ((Page>1) and (Counter <= 8))) do
  47.     begin
  48.       Readln(DocFile, LineRead);
  49.       Inc(Counter);
  50.     end; {...while not Eof(DocFile) and (Counter <= 9) }
  51.     write(Lst, #12);
  52.     Inc(Page);
  53.   end; {...while not Eof(DocFile) }
  54.   Close(DocFile);
  55.   GoToXY(X, Y);
  56.   writeln('done.     ');
  57.   writeln;
  58. end. {...PrintDoc program }